$(document).ready(function(){
    
    
    $.ajax({url:"/list",async:true,success:function(result){
			
			var buildingList=result.building
			listBuilding(buildingList)
			
				//下拉菜单
			     $(".pmume>li>a").click(function(){
	  			 var ulNode=$(this).next("ul");
  	   			 ulNode.toggle("normal");
       			 
    			 });  
				
	}})
    
   
    

    
});

function listBuilding(buildingList){
//	$(".building").empty();
	
	var type1=""
	
	var type2
	var ctype1=""
	var ctype2
	
	for(var i=0;i<buildingList.length;i++){
		var ctype1=""
	    var ctype2=""
		for(var j=0;j<buildingList[i].roomList.length;j++){
			ctype2='<li><a href="">'+buildingList[i].roomList[j].name+'</a></li>'
            ctype1=ctype1+ctype2	
            		
		}
		ctype1='<ul class="nav left_mume">'+ctype1+'</ul>'
		
		type2='<li><a href="#">'+buildingList[i].name+'</a>'+ctype1+'</li>'
		
		type1=type1+type2

	}
	$(".building").append(type1)
}

